package com.hb.unic.admin.controller;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hb.unic.core.log.Audit;
import com.hb.unic.core.log.UnicLogger;
import com.hb.unic.core.log.UnicLoggerFactory;

/**
 * 这里是描述
 *
 * @since v1.0，2023/8/26 13:58，create by Mr.Huang.
 */
@RestController
@RequestMapping("/test")
public class TestController implements InitializingBean {

    private static final UnicLogger UNIC_LOGGER = UnicLoggerFactory.getLogger(TestController.class);

    @Override
    public void afterPropertiesSet() throws Exception {
        UNIC_LOGGER.info("进入了test controller");
    }

    @GetMapping("/test1")
    public Object test1() {
        UNIC_LOGGER.info("进入了test controller");
        return "success";
    }

    @GetMapping("/test2")
    @Audit(module = "unic-admin", operation = "测试", content = "用户名是#{['username']}， 密码是#{['password']}")
    public Object test2(@RequestParam("username") String username, @RequestParam("password") String password) {
        UNIC_LOGGER.info("进入了test controller");
        return "success";
    }
}
